#ifndef MOVE_H
#define MOVE_H

#include "common.h"

//------------------------------------------------------------
// move : packed into 20bit
//  ex1) 7776FU = 0x77761
//  ex2) 8822UM = 0x8822e
//  ex3) 0055KE = 0x00553

#define MOVE(f,t,k) ((f)<<12|(t)<<4|(k))
#define MOVE_FROM(mv) ((mv)>>12)
#define MOVE_TO(mv) (((mv)>>4)&0xFF)
#define MOVE_KIND(mv) ((mv)&0xF)

// undo info : packed into 30bit
#define UNDO(mv,pc,capt) ((mv)<<10|(pc)<<5|(capt))
#define UNDO_MOVE(un) ((un)>>10)
#define UNDO_PIECE(un) (((un)>>5)&0x1F)
#define UNDO_CAPT(un) ((un)&0x1F)

//------------------------------------------------------------

#endif // MOVE_H
